<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>编辑公告</title>

    <script src="js/sockjs.js"></script>
    <script src="js/stomp.js"></script>
    <script src="js/jquery-3.2.1.js"></script>
</head>
<body>

<form id="sangForm">
    <textarea rows="4" cols="60" name="text"></textarea>
    <input type="submit" value="发送"/>
</form>

<script type="text/javascript">

    $("#sangForm").submit(function (e) {
        e.preventDefault();
        var textArea = $("#sangForm").find('textarea[name="text"]');
        var text = textArea.val();
        sendName(text);
        textArea.val('');
    });
    var sock = new SockJS("/webSocket");
    var stomp = Stomp.over(sock);
    stomp.connect({},function (frame) {

    });

    function sendName(value) {

        stomp.send("/api/sendNotice", {}, value);
    }


</script>
</body>
</html>